package com.estar.app.business.mobileLogin.utils;

import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


//联通模板解析返回的字符串
public class ParseReplayUtil {
	private static String parsePattern = "([^=&]+)=([^&]*)";
	public static Properties parse(String line) {
		Properties result = new Properties();
		String str = "";
		if(line.contains("replys=")){
			String[] tmp = line.split("replys=",2);
			result.put("REPLYS", tmp[1]);
			str = tmp[0];
		}else{
			str=line;
		}
		Matcher m = Pattern.compile(parsePattern).matcher(str);
		while (m.find()) {
			String key = m.group(1).trim();
			String value = m.group(2).trim();
			result.put(key.toUpperCase(), value);
		}
		return result;
	}
}
